package com.tuanzi.loan.business.service.system.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.retry.RetryException;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.tuanzi.loan.business.entity.system.UserRole;
import com.tuanzi.loan.business.repository.system.UserRoleRepository;
import com.tuanzi.loan.business.service.system.UserRoleService;
import com.tuanzi.loan.core.aspect.Debug;
import com.tuanzi.loan.core.repository.JPAAuditRepository;
import com.tuanzi.loan.core.service.BaseAuditServiceImpl;

/**
 * @author Ray 2017/09/21
 */
@Debug
@Service
@Transactional
@Retryable(value = { RetryException.class })
public class UserRoleServiceImpl extends BaseAuditServiceImpl<UserRole, String> implements UserRoleService {

    @Autowired
    private UserRoleRepository userRoleRepository;

    @Override
    protected JPAAuditRepository<UserRole, String> getRepository() {
        return userRoleRepository;
    }

    @Override
    public UserRole findByUserIdAndRoleId(String userId, String roleId) {
        return userRoleRepository.findByUserIdAndRoleId(userId, roleId);
    }
}
